test(decode): fix Errorf argument order in array-to-struct case#798
test(decode): fix Errorf argument order in array-to-struct case#798Solaris-star wants to merge 1 commit into
Conversation
TestUnmarshalArrayToStructNoToArrayOptionError swapped the decoded value and error string in t.Errorf, producing misleading failure output. Fixes fxamacker#784
|
Per CONTRIBUTING.md, the issue-first step is meant to align on approach before the implementation work. But the referenced issue was opened by someone else and it was not approved by a maintainer to proceed to a PR. Also, this PR is missing the PR template/checklist that is automatically added to all opened PRs. The PR template asks each contributor to sign off on the Developer Certificate of Origin (DCO) certifying that you created the contribution and have the right to submit it under this project's license. Since AI-generated code has unclear provenance (and can reproduce licensed code), that certification is hard to stand behind for AI-written code. Closing this PR, since it duplicates a fix already offered by the issue author, the issue wasn't approved to proceed to a PR by a maintainer, the PR template/DCO is missing, and the commit is missing the required "Signed-off-by:" line. Thanks for understanding. |
Summary
In
TestUnmarshalArrayToStructNoToArrayOptionError, thet.Errorfcall for the "want error containing" branch swappederr.Error()andv1.That makes failure messages misleading (and mismatches the format verbs).
Fix
Pass
v1thenerr.Error()to match:Decode(%+v) returned error %q, want error containing %qFixes #784
Test plan
go test -run TestUnmarshalArrayToStruct .